package com.mdd.front.controller.points;

import com.mdd.common.core.AjaxResult;
import com.mdd.front.LikeFrontThreadLocal;
import com.mdd.front.service.points.IPointsService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Map;

@RestController
@RequestMapping("api/points")
public class PointsController {

    @Resource
    private IPointsService iPointsService;

    /**
     * 获取抵扣配置
     *
     * @author panweiliang
     * @return Object
     */
    @GetMapping("/setting/get")
    public Object getSetting(@RequestParam("orderPrice")BigDecimal orderPrice) {
        Integer userId = LikeFrontThreadLocal.getUserId();
        Map<String, Object> result = iPointsService.getSetting(userId, orderPrice);
        return AjaxResult.success(result);
    }

}
